Skip to content

fix(concerto-core): support AST objects in addModelFiles and updateModelFile (#1625) - #1626

Open
Atharva15007 wants to merge 3 commits into
accordproject:mainfrom
Atharva15007:fix/1625-astmodelmanager-batch-add
Open

Atharva15007 wants to merge 3 commits into
accordproject:mainfrom
Atharva15007:fix/1625-astmodelmanager-batch-add

Conversation

@Atharva15007

@Atharva15007 Atharva15007 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1625

Changes

  • Updated addModelFiles, updateModelFile, and validateModelFile in BaseModelManager to verify whether the input is already a ModelFile instance via isModelFile.
  • If an AST object (plain JS object) is provided instead of a string or ModelFile instance, it is now routed through this.processFile(fileName, modelFile) to instantiate a ModelFile.
  • Added unit tests in astmodelmanager.js covering batch addition (#addModelFiles), updates (#updateModelFile), and validation (#validateModelFile) for AST objects.

Flags

-None

Screenshots or Video

-N/A

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

…delFile (accordproject#1625)

Signed-off-by: Atharva15007 <datharva157@gmail.com>

@mira-accord-project mira-accord-project Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this fix, Atharva15007. Routing AST objects through processFile in addModelFiles, updateModelFile and validateModelFile looks correct. Existing ModelFile instances still pass through unchanged, and passing null definitions for AST input matches what addModel does. CI is green. To make this mergeable, please strengthen the tests so they would fail if the new branch did nothing (see the should-fix below). The other two points are small improvements.

Nothing blocking; some suggestions below. Findings: 1 should-fix, 2 nit.

  • nit · tests · packages/concerto-core/test/astmodelmanager.js: Some assertions are weak. modelManager.getType(...).should.not.be.null can never fail because getType throws when a type is missing, and the .should.throw() in the update test has no error type or message (TypeNotFoundException would be more precise). In #addModelFiles, consider asserting the declarations are registered, e.g. getType('org.example.test1@1.0.0.Concept1'). A test that addModelFiles rolls back when a later AST is invalid would also be valuable, since the branch change affects every non-string input.
  • nit · docs · packages/concerto-core/src/basemodelmanager.ts: The JSDoc @param types for validateModelFile, updateModelFile and addModelFiles still say string|ModelFile or string[]|ModelFile[], while the behaviour (and ModelFileInput) now also accepts an AST object. Please update them so the generated API docs match.

Automated review by Mira, an Accord Project agent, at 625cb08. Findings are labelled blocking, should-fix or nit; a maintainer makes the final call.

… and JSDocs

Signed-off-by: Atharva15007 <datharva157@gmail.com>
@Atharva15007

Copy link
Copy Markdown
Contributor Author

Addressed in latest commit: added the negative validation test for undeclared types, strengthened assertions with TypeNotFoundException, added rollback testing for addModelFiles, and updated JSDoc @PARAM annotations.

@mttrbrts-agent

Copy link
Copy Markdown
Collaborator

Thanks for the fix and the tests, which cover the AST paths in addModelFiles and updateModelFile, the rollback case and the invalid-type case.

What happens next: the CI runs on this PR are waiting for a maintainer's approval, because the PR comes from a fork. A maintainer will read the change before approving them. We have asked the Concerto maintainers to review it. We can't give a date for a decision yet.

Drafted by an Accord Project agent, reviewed by a maintainer.

@mira-accord-project mira-accord-project Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, Atharva15007. At this head addModelFiles, updateModelFile and validateModelFile accept AST objects as well as strings and ModelFile instances, passing null definitions for AST input. The earlier review points are addressed: the tests now assert on getType, check TypeNotFoundException with its message, cover rollback in addModelFiles, and the JSDoc is updated. I found nothing blocking. The one nit below is optional, and the change is otherwise ready for maintainer review.

Nothing blocking; some suggestions below. Findings: 1 nit.


Automated review by Mira, an Accord Project agent, at d5ef1d4. Findings are labelled blocking, should-fix or nit; a maintainer makes the final call.

@github-actions github-actions Bot added the maintainer-engaged A maintainer has commented or reviewed this item label Nov 13, 2026
… ModelManager.processFile

Signed-off-by: Atharva15007 <datharva157@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(concerto-core): AstModelManager.addModelFiles and updateModelFile throw TypeError when passed AST objects

2 participants